package cn.iocoder.yudao.module.member.api.curriculumVitaeSendRecord;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
import cn.iocoder.yudao.framework.tenant.core.util.TenantUtils;
import cn.iocoder.yudao.module.member.api.curriculumVitaeSendRecord.dto.*;
import cn.iocoder.yudao.module.member.api.job.dto.JobRespDTO;
import cn.iocoder.yudao.module.member.api.studentEducationalExperience.dto.StudentEducationalExperienceRespDTO;
import cn.iocoder.yudao.module.member.controller.admin.collectNotes.vo.CollectNotesCreateReqVO;
import cn.iocoder.yudao.module.member.controller.admin.collectNotes.vo.CollectNotesPageReqVO;
import cn.iocoder.yudao.module.member.controller.admin.collectNotes.vo.CollectNotesRespVO;
import cn.iocoder.yudao.module.member.controller.admin.curriculumVitaeSendRecord.vo.CurriculumVitaeSendRecordCreateReqVO;
import cn.iocoder.yudao.module.member.controller.admin.curriculumVitaeSendRecord.vo.CurriculumVitaeSendRecordGroupPageReqVO;
import cn.iocoder.yudao.module.member.controller.admin.curriculumVitaeSendRecord.vo.CurriculumVitaeSendRecordPageReqVO;
import cn.iocoder.yudao.module.member.controller.admin.curriculumVitaeSendRecord.vo.CurriculumVitaeSendRecordUpdateReqVO;
import cn.iocoder.yudao.module.member.convert.curriculumVitaeSendRecord.CurriculumVitaeSendRecordConvert;
import cn.iocoder.yudao.module.member.convert.studentEducationalExperience.StudentEducationalExperienceConvert;
import cn.iocoder.yudao.module.member.dal.dataobject.company.CompanyDO;
import cn.iocoder.yudao.module.member.dal.dataobject.curriculumVitaeSendRecord.CurriculumVitaeSendRecordDO;
import cn.iocoder.yudao.module.member.dal.dataobject.curriculumVitaeSendRecord.CurriculumVitaeSendRecordGroupDO;
import cn.iocoder.yudao.module.member.dal.dataobject.job.MemberJobDO;
import cn.iocoder.yudao.module.member.dal.dataobject.student.StudentDO;
import cn.iocoder.yudao.module.member.dal.dataobject.studentCurriculumVitae.StudentCurriculumVitaeDO;
import cn.iocoder.yudao.module.member.dal.dataobject.studentEducationalExperience.StudentEducationalExperienceDO;
import cn.iocoder.yudao.module.member.dal.mysql.studentEducationalExperience.StudentEducationalExperienceMapper;
import cn.iocoder.yudao.module.member.service.collectNotes.CollectNotesService;
import cn.iocoder.yudao.module.member.service.company.CompanyService;
import cn.iocoder.yudao.module.member.service.curriculumVitaeSendRecord.CurriculumVitaeSendRecordService;
import cn.iocoder.yudao.module.member.service.job.MemberJobService;
import cn.iocoder.yudao.module.member.service.student.StudentService;
import cn.iocoder.yudao.module.member.service.studentCurriculumVitae.StudentCurriculumVitaeService;
import cn.iocoder.yudao.module.system.api.message.MessageApi;
import cn.iocoder.yudao.module.system.api.message.dto.MessageCreateReqDTO;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.CURRICULUM_VITAE_SEND_RECORD_IS_EXISTS;

/**
 * 投递记录 API 接口
 *
 * @author 芋道源码
 */
@Service
public class CurriculumVitaeSendRecordApiImpl implements CurriculumVitaeSendRecordApi {

     @Resource
     private CurriculumVitaeSendRecordService curriculumVitaeSendRecordService;

     @Resource
     private MemberJobService memberJobService;
     @Resource
     private CompanyService companyService;
     @Resource
     private StudentService studentService;
     @Resource
     private StudentCurriculumVitaeService studentCurriculumVitaeService;
     @Resource
     private StudentService userService;
     @Resource
     private MemberJobService jobService;
     @Resource
     private StudentEducationalExperienceMapper studentEducationalExperienceMapper;
     @Resource
     private CollectNotesService collectNotesService;
     @Resource
     private MessageApi messageApi;
     @Resource
     private AdminUserApi adminUserApi;

     @Override
     public PageResult<CurriculumVitaeSendRecordGroupRespDTO> checkInfoByJob(CurriculumVitaeSendRecordGroupPageReqDTO pageVO) {
          CurriculumVitaeSendRecordGroupPageReqVO curriculumVitaeSendRecordGroupPageReqVO=new CurriculumVitaeSendRecordGroupPageReqVO();
          BeanUtils.copyProperties(pageVO,curriculumVitaeSendRecordGroupPageReqVO);
          PageResult<CurriculumVitaeSendRecordGroupDO> pageResult = curriculumVitaeSendRecordService.checkInfoByJob(curriculumVitaeSendRecordGroupPageReqVO);
          return CurriculumVitaeSendRecordConvert.INSTANCE.convertPage4(pageResult);
     }

     @Override
     public PageResult<CurriculumVitaeSendRecordRespDTO> getpageByJob(CurriculumVitaeSendRecordPageReqDTO pageVO) {
          CurriculumVitaeSendRecordPageReqVO curriculumVitaeSendRecordDO=new CurriculumVitaeSendRecordPageReqVO();
          BeanUtils.copyProperties(pageVO,curriculumVitaeSendRecordDO);
          PageResult<CurriculumVitaeSendRecordDO> pageResult = curriculumVitaeSendRecordService.getpageByJob(curriculumVitaeSendRecordDO);
          return CurriculumVitaeSendRecordConvert.INSTANCE.convertPage2(pageResult);
     }

     @Override
     public PageResult<CurriculumVitaeSendRecordRespDTO> getCurriculumVitaeSendRecordPage(CurriculumVitaeSendRecordPageReqDTO pageReqVO) {
          CurriculumVitaeSendRecordPageReqVO c=new CurriculumVitaeSendRecordPageReqVO();
          BeanUtils.copyProperties(pageReqVO,c);
//          PageResult<CurriculumVitaeSendRecordRespDTO> pageResult1 = new PageResult<>();
          PageResult<CurriculumVitaeSendRecordDO> pageResult = curriculumVitaeSendRecordService.getCurriculumVitaeSendRecordPage1(c );
          if ( pageResult == null ||CollectionUtils.isEmpty(pageResult.getList()) ) {
               return new PageResult<>();
          }
//          List<CurriculumVitaeSendRecordRespDTO> list1 = new ArrayList<>( pageResult.getList().size());
          for ( CurriculumVitaeSendRecordDO curriculumVitaeSendRecordDO : pageResult.getList() ) {
//               CurriculumVitaeSendRecordRespDTO s=new CurriculumVitaeSendRecordRespDTO();
//               BeanUtils.copyProperties(curriculumVitaeSendRecordDO,s);
               List<StudentEducationalExperienceDO> experienceDOList = studentEducationalExperienceMapper.selectListByStudentId(curriculumVitaeSendRecordDO.getResumeId());
               curriculumVitaeSendRecordDO.setEducationalExperience(experienceDOList);
//               list1.add(s);
          }
//          pageResult1.setList(list1);
//          pageResult1.setTotal( pageResult.getTotal() );
          return CurriculumVitaeSendRecordConvert.INSTANCE.convertPage2(pageResult);
     }
     @Override
     public Long createCurriculumVitaeSendRecord(CurriculumVitaeSendRecordCreateReqDTO createReqVO) {
          CurriculumVitaeSendRecordCreateReqVO curriculumVitaeSendRecordCreateReqVO=new CurriculumVitaeSendRecordCreateReqVO();
          BeanUtils.copyProperties(createReqVO,curriculumVitaeSendRecordCreateReqVO);
          return curriculumVitaeSendRecordService.createCurriculumVitaeSendRecord(curriculumVitaeSendRecordCreateReqVO);
     }

     @Override
     public Long sendCurriculumVitaeSendRecord(CurriculumVitaeSendRecordCreateReqDTO createReqVO) {
          CurriculumVitaeSendRecordPageReqDTO pageVO=new CurriculumVitaeSendRecordPageReqDTO();
          pageVO.setJobId(createReqVO.getJobId());
          pageVO.setStudentId(createReqVO.getUserId());
          pageVO.setResumeId(createReqVO.getResumeId());
          if(isSend(pageVO)){
               throw exception(CURRICULUM_VITAE_SEND_RECORD_IS_EXISTS);
          }
          MemberJobDO memberJobDO=memberJobService.getJob(createReqVO.getJobId(),0);
          StudentDO studentDO=studentService.getStudent(createReqVO.getUserId());
          StudentCurriculumVitaeDO studentCurriculumVitaeDO=studentCurriculumVitaeService.getStudentCurriculumVitae(createReqVO.getResumeId());
          CompanyDO companyDO=companyService.getCompany(memberJobDO.getCompanyId(),0);
          AdminUserRespDTO  adminUserRespDTO=adminUserApi.getUser(companyDO.getPhoneNumber());
          //组装
          CurriculumVitaeSendRecordCreateReqVO curriculumVitaeSendRecordCreateReqVO=this.pageCurriculumVitaeSendRecordCreateReqVO(memberJobDO,studentDO,studentCurriculumVitaeDO,companyDO);
          String title=memberJobDO.getJobName()+"：投递简历 -"+studentCurriculumVitaeDO.getName();
          String message="您好，收到"+studentDO.getNickname()+"针对"+memberJobDO.getJobName()+"职位投递，请注意查收。";
          sendmessage(1l, adminUserRespDTO.getId(),title,message);
          return curriculumVitaeSendRecordService.createCurriculumVitaeSendRecord(curriculumVitaeSendRecordCreateReqVO);
     }

     @Async
     void sendmessage(Long type, Long id, String title, String messageText){
          MessageCreateReqDTO messageCreateReqVO=new MessageCreateReqDTO();
          messageCreateReqVO.setPhone("");
          messageCreateReqVO.setType(type);
          messageCreateReqVO.setStatus("5");
          messageCreateReqVO.setUserId(id);
          messageCreateReqVO.setStudentName("系统管理员");
          messageCreateReqVO.setRemark(messageText);
          messageCreateReqVO.setTitle(title);
          messageApi.sendMessage(messageCreateReqVO);
     }
     @Override
     public Long sendCurriculumVitaeSendRecord(Long jobId,Long studentId,Long resumeId,String status,String source,String type) {
          CurriculumVitaeSendRecordPageReqDTO pageVO=new CurriculumVitaeSendRecordPageReqDTO();
          pageVO.setJobId(jobId);
          pageVO.setStudentId(studentId);
          if(isSend(pageVO)){
               throw exception(CURRICULUM_VITAE_SEND_RECORD_IS_EXISTS);
          }
          MemberJobDO memberJobDO=memberJobService.getJob(jobId,0);
          StudentDO studentDO=studentService.getStudent(studentId);
          StudentCurriculumVitaeDO studentCurriculumVitaeDO=studentCurriculumVitaeService.getStudentCurriculumVitae(resumeId);
          CompanyDO companyDO=companyService.getCompany(memberJobDO.getCompanyId(),0);
          //组装
          CurriculumVitaeSendRecordCreateReqVO curriculumVitaeSendRecordCreateReqVO=this.pageCurriculumVitaeSendRecordCreateReqVO(memberJobDO,studentDO,studentCurriculumVitaeDO,companyDO,source,type);
          Integer postCount=memberJobDO.getPostCount();
          if(postCount==null){
               postCount=0;
          }else{
               postCount++;
          }
          AdminUserRespDTO  adminUserRespDTO=adminUserApi.getUser(companyDO.getPhoneNumber());
          String title=memberJobDO.getJobName()+"：投递简历 -"+studentCurriculumVitaeDO.getName();
          String message="您好，收到"+studentDO.getNickname()+"针对"+memberJobDO.getJobName()+"职位投递，请注意查收。";
          sendmessage(1l, adminUserRespDTO.getId(),title,message);
          return curriculumVitaeSendRecordService.createCurriculumVitaeSendRecord(curriculumVitaeSendRecordCreateReqVO);
     }


     /**
      * 组装对象
      * @param memberJobDO
      * @param studentDO
      * @param studentCurriculumVitaeDO
      * @param companyDO
      * @return
      */
     private CurriculumVitaeSendRecordCreateReqVO pageCurriculumVitaeSendRecordCreateReqVO(MemberJobDO memberJobDO,StudentDO studentDO,StudentCurriculumVitaeDO studentCurriculumVitaeDO,CompanyDO companyDO){
          CurriculumVitaeSendRecordCreateReqVO curriculumVitaeSendRecordCreateReqVO=new CurriculumVitaeSendRecordCreateReqVO();
          curriculumVitaeSendRecordCreateReqVO.setStudentId(studentDO.getId());
          curriculumVitaeSendRecordCreateReqVO.setStudentName(studentDO.getNickname());
          curriculumVitaeSendRecordCreateReqVO.setCompanyId(companyDO.getId());
          curriculumVitaeSendRecordCreateReqVO.setCompanyName(companyDO.getCompanyName());
          curriculumVitaeSendRecordCreateReqVO.setJobId(memberJobDO.getId());
          curriculumVitaeSendRecordCreateReqVO.setJobName(memberJobDO.getJobName());
          curriculumVitaeSendRecordCreateReqVO.setPublisherName(memberJobDO.getCreator());
          curriculumVitaeSendRecordCreateReqVO.setResumeId(studentCurriculumVitaeDO.getId());
          curriculumVitaeSendRecordCreateReqVO.setSource("1");
          curriculumVitaeSendRecordCreateReqVO.setCity(memberJobDO.getCity());
          curriculumVitaeSendRecordCreateReqVO.setPostDate(new Date());
          curriculumVitaeSendRecordCreateReqVO.setStudentPictureUrl(studentDO.getStudentPictureUrl());
          curriculumVitaeSendRecordCreateReqVO.setIdentify(studentCurriculumVitaeDO.getIdentify());
          curriculumVitaeSendRecordCreateReqVO.setSex(studentCurriculumVitaeDO.getSex());
          curriculumVitaeSendRecordCreateReqVO.setPolitical(studentCurriculumVitaeDO.getPolitical());
          curriculumVitaeSendRecordCreateReqVO.setBirthday(studentCurriculumVitaeDO.getBirthday());
          curriculumVitaeSendRecordCreateReqVO.setLiveCity(studentCurriculumVitaeDO.getLiveCity());
          curriculumVitaeSendRecordCreateReqVO.setGraduateTime(studentCurriculumVitaeDO.getGraduateTime());
          curriculumVitaeSendRecordCreateReqVO.setNativePlace(studentCurriculumVitaeDO.getNativePlace());
          curriculumVitaeSendRecordCreateReqVO.setClan(studentCurriculumVitaeDO.getClan());
          curriculumVitaeSendRecordCreateReqVO.setPhoneNumber(studentCurriculumVitaeDO.getPhoneNumber());
          curriculumVitaeSendRecordCreateReqVO.setEmail(studentCurriculumVitaeDO.getEmail());
          curriculumVitaeSendRecordCreateReqVO.setInternshipDesire(studentCurriculumVitaeDO.getInternshipDesire());
//          curriculumVitaeSendRecordCreateReqVO.setEducationalExperience(studentCurriculumVitaeDO.getEducationalExperience());
          curriculumVitaeSendRecordCreateReqVO.setStatus("0");
          curriculumVitaeSendRecordCreateReqVO.setUserId(studentDO.getId());
          curriculumVitaeSendRecordCreateReqVO.setDeptId(0l);
          curriculumVitaeSendRecordCreateReqVO.setTenantId(companyDO.getTenantId());
          curriculumVitaeSendRecordCreateReqVO.setLowestSalary(memberJobDO.getLowestSalary());
          curriculumVitaeSendRecordCreateReqVO.setHighestSalary(memberJobDO.getHighestSalary());
          curriculumVitaeSendRecordCreateReqVO.setPracticePeriod(memberJobDO.getPracticePeriod());
          curriculumVitaeSendRecordCreateReqVO.setWorkPeriod(memberJobDO.getWorkPeriod());
          curriculumVitaeSendRecordCreateReqVO.setLanguageAbility(studentCurriculumVitaeDO.getLanguageAbility());
          curriculumVitaeSendRecordCreateReqVO.setWorkExperience(studentCurriculumVitaeDO.getWorkExperience());
          curriculumVitaeSendRecordCreateReqVO.setCourses(studentCurriculumVitaeDO.getCourses());
          curriculumVitaeSendRecordCreateReqVO.setSpecialtyAbility(studentCurriculumVitaeDO.getSpecialtyAbility());
          curriculumVitaeSendRecordCreateReqVO.setCertificates(studentCurriculumVitaeDO.getCertificates());
          curriculumVitaeSendRecordCreateReqVO.setPracticeExperience(studentCurriculumVitaeDO.getPracticeExperience());
          curriculumVitaeSendRecordCreateReqVO.setProjectExperience(studentCurriculumVitaeDO.getProjectExperience());
          curriculumVitaeSendRecordCreateReqVO.setInJobTime(studentDO.getInJobTime());
          curriculumVitaeSendRecordCreateReqVO.setJobStatus(studentDO.getJobStatus());
          return curriculumVitaeSendRecordCreateReqVO;
     }
     private CurriculumVitaeSendRecordCreateReqVO pageCurriculumVitaeSendRecordCreateReqVO(MemberJobDO memberJobDO,StudentDO studentDO,StudentCurriculumVitaeDO studentCurriculumVitaeDO,CompanyDO companyDO,String source,String type){
          CurriculumVitaeSendRecordCreateReqVO curriculumVitaeSendRecordCreateReqVO=new CurriculumVitaeSendRecordCreateReqVO();
          curriculumVitaeSendRecordCreateReqVO.setStudentId(studentDO.getId());
          curriculumVitaeSendRecordCreateReqVO.setStudentName(studentDO.getNickname());
          curriculumVitaeSendRecordCreateReqVO.setCompanyId(companyDO.getId());
          curriculumVitaeSendRecordCreateReqVO.setCompanyName(companyDO.getCompanyName());
          curriculumVitaeSendRecordCreateReqVO.setJobId(memberJobDO.getId());
          curriculumVitaeSendRecordCreateReqVO.setJobName(memberJobDO.getJobName());
          curriculumVitaeSendRecordCreateReqVO.setPublisherName(memberJobDO.getCreator());
          curriculumVitaeSendRecordCreateReqVO.setResumeId(studentCurriculumVitaeDO.getId());
          curriculumVitaeSendRecordCreateReqVO.setSource(source);
          curriculumVitaeSendRecordCreateReqVO.setCity(memberJobDO.getCity());
          curriculumVitaeSendRecordCreateReqVO.setPostDate(new Date());
          curriculumVitaeSendRecordCreateReqVO.setStudentPictureUrl(studentDO.getStudentPictureUrl());
          curriculumVitaeSendRecordCreateReqVO.setIdentify(studentCurriculumVitaeDO.getIdentify());
          curriculumVitaeSendRecordCreateReqVO.setSex(studentCurriculumVitaeDO.getSex());
          curriculumVitaeSendRecordCreateReqVO.setPolitical(studentCurriculumVitaeDO.getPolitical());
          curriculumVitaeSendRecordCreateReqVO.setBirthday(studentCurriculumVitaeDO.getBirthday());
          curriculumVitaeSendRecordCreateReqVO.setLiveCity(studentCurriculumVitaeDO.getLiveCity());
          curriculumVitaeSendRecordCreateReqVO.setGraduateTime(studentCurriculumVitaeDO.getGraduateTime());
          curriculumVitaeSendRecordCreateReqVO.setNativePlace(studentCurriculumVitaeDO.getNativePlace());
          curriculumVitaeSendRecordCreateReqVO.setClan(studentCurriculumVitaeDO.getClan());
          curriculumVitaeSendRecordCreateReqVO.setPhoneNumber(studentCurriculumVitaeDO.getPhoneNumber());
          curriculumVitaeSendRecordCreateReqVO.setEmail(studentCurriculumVitaeDO.getEmail());
          curriculumVitaeSendRecordCreateReqVO.setInternshipDesire(studentCurriculumVitaeDO.getInternshipDesire());
//          curriculumVitaeSendRecordCreateReqVO.setEducationalExperience(studentCurriculumVitaeDO.getEducationalExperience());
          curriculumVitaeSendRecordCreateReqVO.setStatus("0");
          curriculumVitaeSendRecordCreateReqVO.setUserId(studentDO.getId());
          curriculumVitaeSendRecordCreateReqVO.setDeptId(0l);
          curriculumVitaeSendRecordCreateReqVO.setTenantId(companyDO.getTenantId());
          curriculumVitaeSendRecordCreateReqVO.setLowestSalary(memberJobDO.getLowestSalary());
          curriculumVitaeSendRecordCreateReqVO.setHighestSalary(memberJobDO.getHighestSalary());
          curriculumVitaeSendRecordCreateReqVO.setPracticePeriod(memberJobDO.getPracticePeriod());
          curriculumVitaeSendRecordCreateReqVO.setWorkPeriod(memberJobDO.getWorkPeriod());
          curriculumVitaeSendRecordCreateReqVO.setLanguageAbility(studentCurriculumVitaeDO.getLanguageAbility());
          curriculumVitaeSendRecordCreateReqVO.setWorkExperience(studentCurriculumVitaeDO.getWorkExperience());
          curriculumVitaeSendRecordCreateReqVO.setCourses(studentCurriculumVitaeDO.getCourses());
          curriculumVitaeSendRecordCreateReqVO.setSpecialtyAbility(studentCurriculumVitaeDO.getSpecialtyAbility());
          curriculumVitaeSendRecordCreateReqVO.setCertificates(studentCurriculumVitaeDO.getCertificates());
          curriculumVitaeSendRecordCreateReqVO.setPracticeExperience(studentCurriculumVitaeDO.getPracticeExperience());
          curriculumVitaeSendRecordCreateReqVO.setProjectExperience(studentCurriculumVitaeDO.getProjectExperience());
          curriculumVitaeSendRecordCreateReqVO.setSendType(type);
          curriculumVitaeSendRecordCreateReqVO.setInJobTime(studentDO.getInJobTime());
          curriculumVitaeSendRecordCreateReqVO.setJobStatus(studentDO.getJobStatus());
          return curriculumVitaeSendRecordCreateReqVO;
     }

     @Override
     public PageResult<CurriculumVitaeSendRecordRespDTO> getpage(CurriculumVitaeSendRecordPageReqDTO pageVO) {
          CurriculumVitaeSendRecordPageReqVO curriculumVitaeSendRecordDO=new CurriculumVitaeSendRecordPageReqVO();
          BeanUtils.copyProperties(pageVO,curriculumVitaeSendRecordDO);
          PageResult<CurriculumVitaeSendRecordDO>  result=curriculumVitaeSendRecordService.getCurriculumVitaeSendRecordPage(curriculumVitaeSendRecordDO);
          return CurriculumVitaeSendRecordConvert.INSTANCE.convertPage2(result);
     }

     @Override
     public PageResult<CurriculumVitaeSendRecordRespJobDTO> getpageJob(CurriculumVitaeSendRecordPageReqDTO pageVO) {
          CurriculumVitaeSendRecordPageReqVO curriculumVitaeSendRecordDO=new CurriculumVitaeSendRecordPageReqVO();
          BeanUtils.copyProperties(pageVO,curriculumVitaeSendRecordDO);
          PageResult<CurriculumVitaeSendRecordDO>  result=curriculumVitaeSendRecordService.getCurriculumVitaeSendRecordPage(curriculumVitaeSendRecordDO);
          PageResult<CurriculumVitaeSendRecordRespJobDTO> curriculumVitaeSendRecordRespJobDTOPageResult=CurriculumVitaeSendRecordConvert.INSTANCE.convertPage5(result);
          List<CurriculumVitaeSendRecordRespJobDTO> curriculumVitaeSendRecordRespJobDTOList=curriculumVitaeSendRecordRespJobDTOPageResult.getList();
          for (CurriculumVitaeSendRecordRespJobDTO curriculumVitaeSendRecordRespJobDTO:curriculumVitaeSendRecordRespJobDTOList) {
               MemberJobDO memberJobDO=jobService.getJob(curriculumVitaeSendRecordRespJobDTO.getJobId());
               if(memberJobDO!=null) {
                    JobRespDTO jobRespDTO = new JobRespDTO();
                    BeanUtils.copyProperties(memberJobDO, jobRespDTO);
                    curriculumVitaeSendRecordRespJobDTO.setJobRespDTO(jobRespDTO);
               }
          }
          curriculumVitaeSendRecordRespJobDTOPageResult.setList(curriculumVitaeSendRecordRespJobDTOList);
          return  curriculumVitaeSendRecordRespJobDTOPageResult;
     }

     @Override
     public void updateCurriculumVitaeSendRecord(CurriculumVitaeSendRecordUpdateReqDTO updateReqDTO) {
          CurriculumVitaeSendRecordUpdateReqVO curriculumVitaeSendRecordUpdateReqVO=new CurriculumVitaeSendRecordUpdateReqVO();
          BeanUtils.copyProperties(updateReqDTO,curriculumVitaeSendRecordUpdateReqVO);
          curriculumVitaeSendRecordService.updateCurriculumVitaeSendRecord(curriculumVitaeSendRecordUpdateReqVO);
     }

     @Override
     public boolean isSend(CurriculumVitaeSendRecordPageReqDTO pageVO) {
          CurriculumVitaeSendRecordPageReqVO curriculumVitaeSendRecordDO=new CurriculumVitaeSendRecordPageReqVO();
          BeanUtils.copyProperties(pageVO,curriculumVitaeSendRecordDO);
          PageResult<CurriculumVitaeSendRecordDO>  result= curriculumVitaeSendRecordService.getCurriculumVitaeSendRecordPage(curriculumVitaeSendRecordDO);
          return result.getTotal()>0;
     }

     @Override
     public Long noOpenCount(CurriculumVitaeSendRecordPageReqDTO pageVO) {
          return curriculumVitaeSendRecordService.noOpenCount(pageVO.getStudentId());
     }

     @Override
     public CurriculumVitaeSendRecordRespDTO getCurriculumVitaeSend(Long id,Boolean flag) {
          CurriculumVitaeSendRecordRespDTO curriculumVitaeSendRecordRespDTO=new CurriculumVitaeSendRecordRespDTO();
          CurriculumVitaeSendRecordDO curriculumVitaeSendRecordDO=curriculumVitaeSendRecordService.getCurriculumVitaeSendRecord(id);
          BeanUtils.copyProperties(curriculumVitaeSendRecordDO,curriculumVitaeSendRecordRespDTO);
          //教育经历 2022-11-20
          List<StudentEducationalExperienceDO> studentEducationalExperienceDOS=studentEducationalExperienceMapper.selectListByStudentId(curriculumVitaeSendRecordDO.getResumeId());
          List<StudentEducationalExperienceRespDTO> educationalExperience=StudentEducationalExperienceConvert.INSTANCE.convertList1(studentEducationalExperienceDOS);
          curriculumVitaeSendRecordRespDTO.setEducationalExperience(educationalExperience);
          if(flag&&curriculumVitaeSendRecordDO!=null&&curriculumVitaeSendRecordDO.getStatus().equals("0")){
               CurriculumVitaeSendRecordUpdateReqVO updateReqVo=new CurriculumVitaeSendRecordUpdateReqVO();
               updateReqVo.setId(curriculumVitaeSendRecordDO.getId());
               updateReqVo.setStatus("1");
               curriculumVitaeSendRecordService.updateCurriculumVitaeSendRecord(updateReqVo);
          }
          return curriculumVitaeSendRecordRespDTO;
     }

     @Override
     public CurriculumVitaeSendRecordRespDTO getCurriculumVitaeSend(Long studentId, Long jobId, Long companyId, Long resumId) {
          CurriculumVitaeSendRecordRespDTO curriculumVitaeSendRecordRespDTO=new CurriculumVitaeSendRecordRespDTO();
          CurriculumVitaeSendRecordDO curriculumVitaeSendRecordDO=curriculumVitaeSendRecordService.getCurriculumVitaeSendRecordByPara(studentId,jobId,companyId,resumId);
          //教育经历 2022-11-20
          List<StudentEducationalExperienceDO> studentEducationalExperienceDOS=studentEducationalExperienceMapper.selectListByStudentId(curriculumVitaeSendRecordDO.getResumeId());
          curriculumVitaeSendRecordDO.setEducationalExperience(studentEducationalExperienceDOS);
          BeanUtils.copyProperties(curriculumVitaeSendRecordDO,curriculumVitaeSendRecordRespDTO);
          return curriculumVitaeSendRecordRespDTO;
     }

     @Override
     @TenantIgnore
     public void updateCurriculumVitaeSend(CurriculumVitaeSendRecordUpdateReqDTO updateReqDTO) {
          CurriculumVitaeSendRecordUpdateReqVO curriculumVitaeSendRecordUpdateReqVO=new CurriculumVitaeSendRecordUpdateReqVO();
          BeanUtils.copyProperties(updateReqDTO,curriculumVitaeSendRecordUpdateReqVO);
          curriculumVitaeSendRecordService.updateCurriculumVitaeSendRecord(curriculumVitaeSendRecordUpdateReqVO);
     }

     @Override
     public Long createCollectNotes(CollectNotesDTO createReqVO) {
          CollectNotesCreateReqVO c=new CollectNotesCreateReqVO();
          BeanUtils.copyProperties(createReqVO,c);
          return collectNotesService.createCollectNotes(c);
     }

     @Override
     public PageResult<CollectNotesRespDTO> getCollectNotesPage(CollectNotesPageReqDTO pageReqVO) {
          CollectNotesPageReqVO pageReq=new CollectNotesPageReqVO ();
          BeanUtils.copyProperties(pageReqVO,pageReq);
          PageResult<CollectNotesRespVO> collectNotesPage = collectNotesService.getCollectNotesPage(pageReq);
          if ( collectNotesPage == null ||CollectionUtils.isEmpty(collectNotesPage.getList())) {
               return null;
          }
          PageResult<CollectNotesRespDTO> pageResult = new PageResult<>();
          List<CollectNotesRespDTO> list = new ArrayList<>( collectNotesPage.getList().size());
          for ( CollectNotesRespVO curriculumVitaeSendRecordDO : collectNotesPage.getList() ) {
               CollectNotesRespDTO s=new CollectNotesRespDTO();
               BeanUtils.copyProperties(curriculumVitaeSendRecordDO,s);
               list.add(s);
          }
          pageResult.setList(list);
          pageResult.setTotal( collectNotesPage.getTotal() );
          return pageResult;
     }
}
